{include file="public/head"}
<div class="main">
    {include file="public/left"}
    <div class="middle">
    {include file="public/header"}
    <div class='userinfo'>
        {include file="public/userleft"}
        <div class="pub_task">
            <ul class="layui-tab-title">
                <!-- <li data-target="0" class="layui-this">{:__('收支明细')}</li> -->
                <li data-target="1" class="layui-this">{:__('充值记录')}</li>
            </ul>
            <ul class="task_table">
                <dl>
                    <span>{:__('财务编号')}</span>
                    <span>{:__('类型')}</span>
                    <!-- <span>{:__('用途')}</span> -->
                    <span>{:__('金额')}</span>
                    <span>{:__('金币')}</span>
                    <span>{:__('状态')}</span>
                    <span>{:__('时间')}</span>
                </dl>
                
            </ul>
        </div>
    </div>
    <div id="in_page" style="margin-left: 23%;"></div>
    {include file="public/foot"}
    </div>
    {include file="public/right"}
</div>
{include file="public/footer"}
<script>
    var status = '';
    noLog();

    var total = 0;
    function moneylog(newpage,status)
    {
        $.ajax({
            url:'/api/cash/index',
            type:'get',
            data:{'token':token,'page':newpage,'limit':5,type:1},
            success:function(ret){
                if(ret.code == 1){
                    $("._list").remove();
                    if(ret['data'] == '' && ret['data'] == null && ret['data'] == undefined){
                        return fasle;
                    }
                    if(ret['data']['ls'] == '' && ret['data']['ls'] == null && ret['data']['ls'] == undefined){
                        return fasle;
                    }
                    var htl = "";
                    var status = '';
                    for(i in ret['data']['ls']){
                        if(ret['data']['ls'][i]['type'] == 1){
                            status = '{:__("充值")}';
                        } else if(ret['data']['ls'][i]['type'] == 2){
                            status = '{:__("提现")}';
                        }
                        if(ret['data']['ls'][i]['type'] == 1){
                            txt = ret['data']['ls'][i]['pay_flag_txt'];
                        } else if(ret['data']['ls'][i]['type'] == 2){
                            txt = ret['data']['ls'][i]['check_flag_txt'];
                        }
                        if(ret['data']['ls'][i]['follow_no'] == null || ret['data']['ls'][i]['follow_no'] == undefined){
                            ret['data']['ls'][i]['follow_no'] = '';
                        }
                        htl += '<dl class="_list">'
                            +'<span>'+ret['data']['ls'][i]['follow_no']+'</span>'
                            +'<span>'+status+'</span>'
                            // +'<span>{:__("悬赏任务")}</span>'
                            +'<span>'+ret['data']['ls'][i]['cash']+'</span>'
                            +'<span>'+ret['data']['ls'][i]['money']+'</span>'
                            +'<span>'+txt+'</span>'
                            +'<span>'+ret['data']['ls'][i]['create_time']+'</span>'
                            +'</dl>';
                    }
                    $(".task_table").append(htl);
                    total = ret['data']['total'];
                    if(newpage == 1){
                        pagechange();
                    }
                   
                } else if(ret.code != 401){
                    layer.msg(ret.msg,{icon:2});
                }
            }
        });
    }
    function pagechange()
    {
        //分页
        createpage('in_page',total,5,function(obj,first){
            var nowpage = obj.curr;
            if(!first){
                moneylog(nowpage,status);
            }
        });
    }
    $(document).queue('task',function(){
        moneylog(1,status);
    });
    $(document).dequeue('task');
    
    $(document).on("click",'.pub_task .layui-tab-title li',function(){
        var _this = $(this);
        status = _this.attr("data-target");
        moneylog(1,status);
    });
    
    
</script>